package com.sciology.xpathutility.contentassist;

public abstract class AbstractCompletionTrigger {

  /** The QName for the element holding the completion */
  public final static String COMPLETION_VALUE_ATTRIBUTE_QNAME = "completion"; //$NON-NLS-1$
  
  protected String text;
  
  /**
   * Returns <code>true</code> if and only if this trigger is matched by the passed text
   * @param p_text the text to test against
   * @return <code>true</code> if and only if this trigger is matched by the passed text
   */
  public abstract boolean isMatchFor(String p_text);

  /**
   * Returns the string to insert for the given current text if this completion is
   * selected
   * @param p_text the text that is to be completed
   * @return the completion which should be appended
   */
  public abstract String getInsertString(String p_text);

  public abstract String getInsertString();

  public abstract int compareTo(AbstractCompletionTrigger p_other);

  abstract String getPlainProposal();
  
  /**
   * Sets the Text for this trigger
   * @param p_text the text
   */
  public void setText(String p_text) {
    this.text = p_text;
  }
}
